#ifndef PHYSX_CONSOLE_OUTPUT_STREAM_H
#define PHYSX_CONSOLE_OUTPUT_STREAM_H

#include <iostream> 
#include <string>

#include <NxUserOutputStream.h>
#include <Nx.h>

class PhysxConsoleOutputStream : public NxUserOutputStream {
    static const std::string messagePrefix;

    void reportError(NxErrorCode code, const char *message, const char* file, int line) {
        if(code==NXE_DB_INFO || code==NXE_DB_PRINT || code==NXE_NO_ERROR) {
            std::cout << messagePrefix << message << std::endl;
        } else if(code==NXE_DB_WARNING) {
            std::cout << messagePrefix << message << std::endl;
        } else {
            std::cout << messagePrefix << message << std::endl;
        }
    }

    NxAssertResponse reportAssertViolation(const char *message, const char *file,int line) {
        assert(0);
        return NX_AR_CONTINUE;
    }

    void print(const char *message) {
        std::cout << messagePrefix << message << std::endl;
    }
} physxConsoleOutputStream;

const std::string PhysxConsoleOutputStream::messagePrefix("PhysX SDK: ");

#endif //PHYSX_CONSOLE_OUTPUT_STREAM_H
